﻿using University.Workshop.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.ObjectModel;
using University.Workshop.Model;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for RouletteManagerTest and is intended
    ///to contain all RouletteManagerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class RouletteManagerTest
    {
        PokerServer server = new PokerServer();

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for NewTable
        ///</summary>
        [TestMethod()]
        public void NewTableTest()
        {
            server.InitializeServer(3000);
            RouletteManager target = new RouletteManager(); // TODO: Initialize to an appropriate value
            target.NewTable();
            server.DisconnectServer();
        }

        /// <summary>
        ///A test for GiveMeTheResult
        ///</summary>
        [TestMethod()]
        public void GiveMeTheResultTest_1()
        {
            server.InitializeServer(3000);
            RouletteManager target = new RouletteManager(); // TODO: Initialize to an appropriate value
            target.NewTable();
            string sortedNumber = string.Empty; // TODO: Initialize to an appropriate value
            Collection<string> itemsSelected = null; // TODO: Initialize to an appropriate value
            Collection<string> itemsValue = null; // TODO: Initialize to an appropriate value
            long expected = 0; // TODO: Initialize to an appropriate value
            long actual;
            actual = target.GiveMeTheResult(sortedNumber, itemsSelected, itemsValue);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }

        /// <summary>
        ///A test for GiveMeTheResult
        ///</summary>
        [TestMethod()]
        public void GiveMeTheResultTest_2()
        {
            server.InitializeServer(3000);
            RouletteManager target = new RouletteManager(); // TODO: Initialize to an appropriate value
            target.NewTable();
            string sortedNumber = "0"; // TODO: Initialize to an appropriate value
            Collection<string> itemsSelected = new Collection<string>(); // TODO: Initialize to an appropriate value
            itemsSelected.Add("0");
            itemsSelected.Add("0_1");
            itemsSelected.Add("0_2_3");
            itemsSelected.Add("0_2_3_4");
            itemsSelected.Add("0_1_2_3_4");
            itemsSelected.Add("Red");
            itemsSelected.Add("Black");
            itemsSelected.Add("Even");
            itemsSelected.Add("Odd");
            itemsSelected.Add("1to18");
            itemsSelected.Add("19to36");
            itemsSelected.Add("2to1_1");
            itemsSelected.Add("2to1_2");
            itemsSelected.Add("2to1_3");
            itemsSelected.Add("1st12");
            itemsSelected.Add("2nd12");
            itemsSelected.Add("3rd12");
            itemsSelected.Add("1st12");
            itemsSelected.Add("1st12");
            Collection<string> itemsValue = new Collection<string>(); // TODO: Initialize to an appropriate value
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");
            itemsValue.Add("100");            
            long expected = 7700; // TODO: Initialize to an appropriate value
            long actual;
            actual = target.GiveMeTheResult(sortedNumber, itemsSelected, itemsValue);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }


        /// <summary>
        ///A test for GiveMeTheResult
        ///</summary>
        [TestMethod()]
        public void GiveMeTheResultTest_3()
        {
            server.InitializeServer(3000);
            RouletteManager target = new RouletteManager(); // TODO: Initialize to an appropriate value
            target.NewTable();
            string sortedNumber = "0"; // TODO: Initialize to an appropriate value
            Collection<string> itemsSelected = new Collection<string>(); // TODO: Initialize to an appropriate value
            itemsSelected.Add("1");
            Collection<string> itemsValue = new Collection<string>(); // TODO: Initialize to an appropriate value
            itemsValue.Add("100");
            long expected = 0; // TODO: Initialize to an appropriate value
            long actual;
            actual = target.GiveMeTheResult(sortedNumber, itemsSelected, itemsValue);
            Assert.AreEqual(expected, actual);
            server.DisconnectServer();
        }

        /// <summary>
        ///A test for GetAngle
        ///</summary>
        [TestMethod()]
        public void GetAngleTest()
        {
            server.InitializeServer(3000);
            RouletteManager target = new RouletteManager(); // TODO: Initialize to an appropriate value
            target.NewTable();
            string angle = string.Empty; // TODO: Initialize to an appropriate value
            double Add = (360.0 / 38.0);
            double InitialAuxiliarAngle = 360 - (Add / 2);
            double FinalAuxiliarAngle = (Add / 2.0);
            RouletteAngleNumber expected = new RouletteAngleNumber { Number = "0", Color = "Green", FinalAngle = FinalAuxiliarAngle, InitialAngle = InitialAuxiliarAngle }; // TODO: Initialize to an appropriate value
            RouletteAngleNumber actual;
            actual = target.GetAngle(angle);
            Assert.AreEqual(expected.Number, actual.Number);
            server.DisconnectServer();
        }

        [TestMethod()]
        public void GetAngleTest_1()
        {
            server.InitializeServer(3000);
            RouletteManager target = new RouletteManager(); // TODO: Initialize to an appropriate value
            target.NewTable();
            string angle = "0"; // TODO: Initialize to an appropriate value
            double Add = (360.0 / 38.0);
            double InitialAuxiliarAngle = 360 - (Add / 2);
            double FinalAuxiliarAngle = (Add / 2.0);
            RouletteAngleNumber expected = new RouletteAngleNumber { Number = "0", Color = "Green", FinalAngle = FinalAuxiliarAngle, InitialAngle = InitialAuxiliarAngle }; // TODO: Initialize to an appropriate value
            RouletteAngleNumber actual;
            actual = target.GetAngle(angle);
            Assert.AreEqual(expected.Number, actual.Number);
            server.DisconnectServer();
        }

        [TestMethod()]
        public void GetAngleTest_2()
        {
            server.InitializeServer(3000);
            RouletteManager target = new RouletteManager(); // TODO: Initialize to an appropriate value
            target.NewTable();
            string angle = "460"; // TODO: Initialize to an appropriate value
            double Add = (360.0 / 38.0);
            double InitialAuxiliarAngle = 360 - (Add / 2);
            double FinalAuxiliarAngle = (Add / 2.0);
            RouletteAngleNumber expected = new RouletteAngleNumber { Number = "13", Color = "Green", FinalAngle = FinalAuxiliarAngle, InitialAngle = InitialAuxiliarAngle }; // TODO: Initialize to an appropriate value
            RouletteAngleNumber actual;
            actual = target.GetAngle(angle);
            Assert.AreEqual(expected.Number, actual.Number);
            server.DisconnectServer();
        }
    }
}
